package com.tg.app.activity;


import android.os.Bundle;
import android.text.TextUtils;
import android.view.Window;

import androidx.annotation.Nullable;

import com.tg.app.R;
import com.tg.app.activity.base.WebBaseActivity;
import com.tg.app.util.WebSoftInputHelper;

public class WebActivity extends WebBaseActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//remove title bar  即隐藏标题栏
        setContentView(R.layout.activity_web);
        hideActionBar();
        WebSoftInputHelper.assistActivity(this);
        tvTitle = findViewById(R.id.device_name);
        tvTitle.setText(getIntent().getStringExtra(KEY_WEBTITLE));

        findViewById(R.id.back_toolbar).setOnClickListener(view -> {
            if (mWebview.canGoBack()) {
                mWebview.goBack();
            } else {
                finish();
            }
        });
        mWebview = findViewById(R.id.webview);
        mWebUrl = getIntent().getStringExtra(KEY_WEBURL);
        if (!TextUtils.isEmpty(mWebUrl)) {
            initWeb();
        }
    }
}